<?php
//获取信息
require "../config.php";
//查询参数，有：
/*
 * shooting_team:按拍摄团队分类
 * shooting_people：按拍摄对象汇总
 * album_title：按图集标题汇总
 */
$select_obj=$_POST['select_obj'];
$conn = new mysqli($MySqlHost, $MySqlUser, $MySqlPwd, $MySqlDatabaseName);
if (!$conn) {
    die("连接失败: " . mysqli_connect_errno());
} else {
    //返回
    $res=mysqli_query($conn,"SELECT $select_obj FROM img_all GROUP BY $select_obj");
    return_all($res);
}

function return_all($res){
    //返回JSON
    $all_num = mysqli_num_rows($res);
    $r_json = array();
    $r_json['len'] = $all_num;
    for($i=0;$i<=$all_num-1;$i++){
        $r = mysqli_fetch_row($res);
        $r_json['data'][$i]=$r[0];
    }
    echo json_encode($r_json);
    mysqli_free_result($res);
}